package me.zk.practice1.hw;

import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

/**
 * @author zhangkai
 * @date 2023/8/7 15:42
 */
public class HWBJ75 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();

        String[] nums = s.split(",");

        Arrays.sort(nums, new Comparator<String>() {
            @Override
            public int compare(String o1, String o2) {
                return o1.charAt(o1.length()-1)-o2.charAt(o2.length()-1);
            }
        });
        System.out.println(Arrays.toString(nums));
    }
}
